<!--这是物料渲染器-->
<template>
  <div>
    <component :is="material"></component>
  </div>
</template>

<script setup lang="ts">
import { defineProps } from 'vue';

import TextMaterial from "@/material/internal/TextMaterial.vue"
import ChartMaterial from "@/material/internal/ChartMaterial.vue"
import ImageMaterial from "@/material/internal/ImageMaterial.vue"

// 使用 defineProps 来解构并定义你期望从父组件接收的属性
const {materialType} = defineProps<{materialType: string}>();

let material:any;
switch (materialType) {
  case 'text':
    material = TextMaterial;
    break;
  case "chart":
    material = ChartMaterial;
    break;
  case "image":
    material = ImageMaterial;
    break;
  default:
    material = TextMaterial;
    break;
}
</script>

<style scoped>
</style>
